package com.aios.dao;

import com.aios.entity.SwitchPanel;
import com.aios.entity.SwitchPanelExample;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

public interface SwitchPanelMapper {

	int countByExample(SwitchPanelExample example);

	int deleteByExample(SwitchPanelExample example);

	int deleteByPrimaryKey(String id);

	int insert(SwitchPanel record);

	int insertSelective(SwitchPanel record);

	List<SwitchPanel> selectByExample(SwitchPanelExample example);

	SwitchPanel selectByPrimaryKey(String id);

	int updateByExampleSelective(@Param("record") SwitchPanel record,
			@Param("example") SwitchPanelExample example);

	int updateByExample(@Param("record") SwitchPanel record,
			@Param("example") SwitchPanelExample example);

	int updateByPrimaryKeySelective(SwitchPanel record);

	int updateByPrimaryKey(SwitchPanel record);

	@Select("SELECT sp.* FROM switch_panel sp, system_user_has_switch_panel suhsp WHERE sp.ID = suhsp.SWITCH_PANEL_ID AND SYSTEM_USER_ID = #{id}")
	@ResultMap("MiniResultMap")
	List<SwitchPanel> findByUserId(@Param("id") String userId);

	@Select("SELECT * FROM switch_panel WHERE ID = #{id}")
	@ResultMap("MiniResultMap")
	SwitchPanel findById(@Param("id") String id);

	int delete(String id);

	@Select("SELECT * FROM switch_panel")
	@ResultMap("BaseResultMap")
	List<SwitchPanel> findall();

}